home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / util / dtype / cdt_39_10.lha / cdt / source / RCS / classbase.h,v < prev    next >
Text File  |  1995-06-04  |  6KB  |  278 lines

  1. head    39.4;
  2. access;
  3. symbols
  4.     V39_10:39.4
  5.     c3910:39.4
  6.     V39_9:39.3;
  7. locks; strict;
  8. comment    @ * @;
  9.  
  10.  
  11. 39.4
  12. date    95.06.04.16.48.00;    author StRuppert;    state Exp;
  13. branches;
  14. next    39.3;
  15.  
  16. 39.3
  17. date    95.05.10.14.57.49;    author StRuppert;    state Exp;
  18. branches;
  19. next    ;
  20.  
  21.  
  22. desc
  23. @initial
  24. @
  25.  
  26.  
  27. 39.4
  28. log
  29. @added tabs buffer
  30. @
  31. text
  32. @/*
  33. ** $PROJECT: c.datatype
  34. **
  35. ** $VER: classbase.h 39.4 (04.06.95)
  36. **
  37. ** by
  38. **
  39. ** Stefan Ruppert , Windthorststraße 5 , 65439 Flörsheim , GERMANY
  40. **
  41. ** (C) Copyright 1995
  42. ** All Rights Reserved !
  43. **
  44. ** $HISTORY:
  45. **
  46. ** 04.06.95 : 039.004 : added tabs buffer
  47. ** 14.04.95 : 039.003 : added inline args support
  48. ** 11.03.95 : 039.002 : pen allocation stuff added
  49. ** 06.03.95 : 039.001 : initial
  50. */
  51.  
  52. /* ------------------------------- includes ------------------------------- */
  53.  
  54. #include <dos/dos.h>
  55. #include <dos/dosextens.h>
  56. #include <exec/types.h>
  57. #include <exec/ports.h>
  58. #include <exec/memory.h>
  59. #include <exec/lists.h>
  60. #include <exec/semaphores.h>
  61. #include <exec/execbase.h>
  62. #include <intuition/classes.h>
  63. #include <intuition/classusr.h>
  64. #include <intuition/cghooks.h>
  65. #include <intuition/gadgetclass.h>
  66. #include <graphics/gfxbase.h>
  67. #include <graphics/gfx.h>
  68. #include <graphics/text.h>
  69. #include <libraries/iffparse.h>
  70. #include <datatypes/datatypes.h>
  71. #include <datatypes/datatypesclass.h>
  72. #include <datatypes/textclass.h>
  73. #include <clib/alib_protos.h>
  74. #include <clib/alib_stdio_protos.h>
  75. #include <string.h>
  76. #include <dos.h>
  77.  
  78. #include <clib/macros.h>
  79. #include <clib/dos_protos.h>
  80. #include <clib/exec_protos.h>
  81. #include <clib/intuition_protos.h>
  82. #include <clib/iffparse_protos.h>
  83. #include <clib/graphics_protos.h>
  84. #include <clib/utility_protos.h>
  85. #include <clib/datatypes_protos.h>
  86. #include <clib/dtclass_protos.h>
  87.  
  88. #include <pragmas/dos_pragmas.h>
  89. #include <pragmas/exec_pragmas.h>
  90. #include <pragmas/intuition_pragmas.h>
  91. #include <pragmas/iffparse_pragmas.h>
  92. #include <pragmas/graphics_pragmas.h>
  93. #include <pragmas/utility_pragmas.h>
  94. #include <pragmas/datatypes_pragmas.h>
  95. #include <pragmas/dtclass_pragmas.h>
  96.  
  97. #include <ctype.h>
  98.  
  99. /* --------------------------- include my stuff --------------------------- */
  100.  
  101. #include <register.h>
  102. #include <debug.h>
  103.  
  104. #define ClassCall    LibCall
  105.  
  106. #include "protos.h"
  107.  
  108. /* -------------- set some stuff for the generic classbase.c -------------- */
  109.  
  110. /* set , which datatype library should be opened during our OpenLibrary() */
  111. #define SUPERCLASSDATATYPE       "datatypes/text.datatype"
  112.  
  113. /* set the function name to get a pointer to our class */
  114. #define ENGINE                   ObtainCEngine
  115.  
  116. #define DATATYPENAME             "c.datatype"
  117.  
  118. /* ------------------------- ClassBase structure -------------------------- */
  119.  
  120. struct ClassBase
  121. {
  122.      struct Library               cb_Lib;
  123.      UWORD                        cb_UsageCnt;
  124.      struct Library              *cb_SysBase;
  125.      struct Library              *cb_DOSBase;
  126.      struct Library              *cb_IntuitionBase;
  127.      struct Library              *cb_GfxBase;
  128.      struct Library              *cb_UtilityBase;
  129.      struct Library              *cb_IFFParseBase;
  130.      struct Library              *cb_DataTypesBase;
  131.      struct Library              *cb_SuperClassBase;
  132.      BPTR                         cb_SegList;
  133.  
  134.      struct SignalSemaphore       cb_Lock;               /* Access lock */
  135.      Class                       *cb_Class;
  136. };
  137.  
  138. /* ---------------------------- library bases ----------------------------- */
  139.  
  140. #define SysBase                 cb->cb_SysBase
  141. #define DOSBase                 cb->cb_DOSBase
  142. #define UtilityBase             cb->cb_UtilityBase
  143. #define IntuitionBase           cb->cb_IntuitionBase
  144. #define IFFParseBase            cb->cb_IFFParseBase
  145. #define GfxBase                 cb->cb_GfxBase
  146. #define DataTypesBase           cb->cb_DataTypesBase
  147. #define SuperClassBase          cb->cb_SuperClassBase
  148.  
  149. /* ----------------------- datatype specific stuff ------------------------ */
  150.  
  151. enum
  152. {
  153.     /* modes with style */
  154.     C_STANDARD,
  155.     C_COMMENT,
  156.     C_CPP,
  157.     C_KEYWORD,
  158.     C_STORAGE,
  159.     C_TYPES,
  160.     C_TYPENAME,
  161.     C_STRING,
  162.     C_NUMBER,
  163.     C_MAX,
  164.  
  165.     /* modes without style */
  166.     C_CPPTEXTLIST,
  167. };
  168.  
  169. struct Style
  170. {
  171.     UWORD FgPen;
  172.     UWORD BgPen;
  173.     UWORD Style;
  174. };
  175.  
  176. struct cdtMem
  177. {
  178.     struct cdtMem *Next;
  179.     ULONG Size;
  180. };
  181.  
  182. struct PenNode
  183. {
  184.     struct MinNode pn_Node;
  185.     ULONG pn_Red;
  186.     ULONG pn_Green;
  187.     ULONG pn_Blue;
  188.     ULONG pn_Section;
  189.     LONG pn_Pen;
  190. };
  191.  
  192. #define INLINE_BUFFER      50
  193.  
  194. struct InlineArgs
  195. {
  196.     ULONG Lines;
  197.     UBYTE Keyword[INLINE_BUFFER];
  198.     UBYTE Pattern[INLINE_BUFFER];
  199. };
  200.  
  201. /* ---------------------------- instance data ----------------------------- */
  202.  
  203. struct CData
  204. {
  205.     APTR cd_Pool;
  206.  
  207.     UWORD cd_TabLength;
  208.     struct
  209.     {
  210.         ULONG Nested : 1;
  211.         ULONG Inline : 1;
  212.     } cd_Flags;
  213.  
  214.     struct InlineArgs cd_Inline;
  215.  
  216.     struct List cd_PenList;
  217.     struct ColorMap *cd_ColorMap;
  218.  
  219.     struct Style cd_CStyle[C_MAX];
  220.  
  221.     struct List cd_UserTypes;
  222.  
  223.     UBYTE cd_TabBuffer[100];
  224. };
  225.  
  226. /* --------------------------- parser structure --------------------------- */
  227.  
  228. struct CParse
  229. {
  230.     STRPTR BegPtr;          /* pointer to the begin of the hole text */
  231.     STRPTR SegPtr;          /* pointer to the text for the next segment */
  232.     STRPTR TxtPtr;          /* pointer to the text for the next text segment */
  233.     STRPTR ActPtr;          /* Actual text pointer */
  234.     STRPTR EndPtr;          /* End text pointer */
  235.  
  236.     UWORD TabWidth;
  237.  
  238.     LONG Chars;
  239.     UWORD Mode;
  240.     UWORD LastMode;         /* last segment index */
  241.     int Token;              /* last token */
  242.  
  243.     ULONG XOffset;
  244.     ULONG YOffset;
  245.     ULONG XOffsetAdd;       /* for tab handling */
  246.  
  247.     ULONG MaxWidth;
  248.  
  249.     struct List *LineList;  /* list to append line segments */
  250.     struct RastPort *RPort; /* tempory RastPort for TextLength() */
  251.  
  252.     struct cdtMem *Memory;  /* memory handling for bison parser */
  253.  
  254.     struct CData *Data;     /* link to the instance data */
  255. };
  256.  
  257. int cdtparse_parse(struct ClassBase *cb,struct CParse *cparse);
  258. int cdtparse_error(char *errstr);
  259. void *cdtparse_alloc(struct ClassBase *cb,struct CParse *cparse,int size);
  260.  
  261. /* redirect bison alloca() to my own memory handling function */
  262. #define alloca(x)    cdtparse_alloc(cb,cparse,x)
  263.  
  264. @
  265.  
  266.  
  267. 39.3
  268. log
  269. @*** empty log    message    ***
  270. @
  271. text
  272. @d4 1
  273. a4 1
  274. ** $VER: classbase.h 39.3 (14.04.95)
  275. d15 1
  276. d191 2
  277. @
  278.